package oj;

public class LC345 {
    public String reverseVowels(String s) {
        int start=0;
        int end=s.length()-1;
        char[] arr=s.toCharArray();
        while(start<end){
            while(start<end && !isContains(arr[start])){
                start++;
            }
            while(start<end && !isContains(arr[end])){
                end--;
            }
            if(start<end){
                swap(arr,start,end);
                start++;
                end--;
            }
        }
        return new String(arr);
    }
    public static boolean isContains(char a){
        String str="aeiouAEIOU";
        return str.indexOf(a)>=0;
    }
    public static void swap(char[] arr,int i,int j){
        char temp=arr[i];
        arr[i]=arr[j];
        arr[j]=temp;
    }
}
